#include "altmapeditor.h"

#include <QCoreApplication>
#include <QCloseEvent>
#include <QLabel>
#include <QMenu>
#include <QMenuBar>
#include <QStatusBar>

namespace Alt {
     MapEditor::MapEditor(QWidget* parent) : AbstractMapEditor(parent) {
          init();
     }

     QString MapEditor::defaultFileFilter() const {
          return "";
     }

     Map* MapEditor::map() const {
          return 0;
     }

     //private
     void MapEditor::init() {
          setAttribute(Qt::WA_DeleteOnClose, true);
          m_fileMenu->removeAction(m_fileSaveAction);
          m_fileMenu->removeAction(m_fileSaveAsAction);
          m_fileMenu->removeAction(m_fileCloseAction);

          QAction* quitAction = m_fileMenu->addAction(QIcon(":/quit.svg"), tr("&Quit"));
          quitAction->setMenuRole(QAction::QuitRole);
          quitAction->setStatusTip(tr("Quits the application and closes all open editors."));
          quitAction->setShortcut(tr("Ctrl+q"));
          quitAction->setShortcutContext(Qt::ApplicationShortcut);
          connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));

          m_label = new QLabel(tr("Welcome to the Alt Map Editor!\n"
                                  "To get started, select New or Open from the File menu.\n"), this);
          m_label->setAlignment(Qt::AlignCenter);
          setCentralWidget(m_label);

          setStatusBar(new QStatusBar);
          setWindowTitle(tr("Map editor"));
          return;
     }
}
